<template lang="html">
	<div class="ask">
		<div class="title">
			<input type="text" name="" value="" placeholder="请输入标题" v-model="title">
		</div>
		<div class="line"> </div>
		<div class="comment">
			<textarea name="name" rows="8" cols="80" placeholder="请输入问题描述 (选项)" v-model="titleContent"></textarea>
		</div>
		<div class="bottom">
			<button class="submit" :disabled="disabled" @click="submitClick()">
				完 成
			</button>
		</div>
		<!-- <i class="mymintui-success"></i> -->
	</div>
</template>

<script>
import {subProblem} from "@/components/common/API/msgboard";
import {config} from "@/components/common/API/config";
import { mapGetters} from 'vuex'
export default {
	data() {
		return {
			title: '',
			titleContent: '',
			popupshow:true,
			disabled:false
		}
	},
	methods: {
		submitClick() {
			if($.trim(this.title)=='' && $.trim(this.titleContent)==''){
				this.$toast({
					message: '内容不能为空',
				});
				return;
			}
			this.disabled=true
			let data = {
				title: this.title,
				titleContent: this.titleContent,
				moduleid:this.vuexmoduleid
			}
			this.log('提交提问', data)
			let _this=this	
			subProblem(data).then((res)=>{
				this.disabled=false
				if(res.code==1){
					this.$messagebox.alert('身份过期重新登入', '提示').then(()=>{
						 window.location.href=config.service.index
					});
					// window.location.href=config.service.index
					return;
				}
				if(res.code==2){
					this.$messagebox.alert('对不起,你暂无此权限请联系管理员', '提示');
					// window.location.href=config.service.index
					return;
				}
				this.$toast({
					message: '提交成功',
					iconClass: 'mint-toast-icon mintui mintui-success'
				});
				this.$router.push({// 完成后跳转首页
					path: '/',
				})

			})
			// ajax	
		}
	},
	computed:{
		...mapGetters([
		  'vuexmoduleid',
		]),
		vuexmoduleid(){
			return this.$store.state.vuexmoduleid
		}
	}
}
</script>

<style lang="scss" scoped>
	.mint-toast-text {//修改原代码
		font-size: 40px;
		display: block;
		text-align: center
	}
	.mintui {
		font-family:"mintui" !important;
		font-size:1rem;
		font-style:normal;
		-webkit-font-smoothing: antialiased;
		-webkit-text-stroke-width: 0.2px;
		-moz-osx-font-smoothing: grayscale;
	}


	.ask {
		width: 710px;
		margin: 10px auto 0 auto;
		.title {
			input {
				font-size: 30px;
				height: 45px;
				width: 100%;
				outline: none;
				border: none;
			}
			input::-webkit-input-placeholder {
				color:#c3c3c3;
			}
		}
		.line {
			height: 3px;
			width: 100%;
			background: #3B9CCA;
			margin: 15px 0 20px 0;

		}
		.comment {
			textarea {
				width: 99.5%;
				border: none;
				font-size: 30px;
				height: 60vh;
			}
			textarea:focus {
				outline: red;
			}
			textarea::-webkit-input-placeholder {
				color:#c3c3c3;
			}
		}
		.bottom {
			.submit {
				height: 88px;
				width: 100%;
				color: #fff;
				background: #26a2ff	;
				font-size: 30px;
				text-align: center;
				line-height: 88px;
			}
		}
	}
</style>
